package edu.nf.ch09.exception;

import edu.nf.ch09.web.vo.ResultVO;
import org.springframework.web.bind.annotation.ExceptionHandler;
import org.springframework.web.bind.annotation.RestController;
import org.springframework.web.bind.annotation.RestControllerAdvice;

/**
 * @author wangl
 * @date 2025/5/15
 */
@RestControllerAdvice(basePackages = "edu.nf.ch09.web")
public class GlobalExceptionAdvice {

    @ExceptionHandler(Exception.class)
    public ResultVO handleException(Exception e) {
        e.printStackTrace();
        ResultVO vo = new ResultVO();
        vo.setCode(500);
        vo.setMessage("服务器异常");
        return vo;
    }
}